package cn.jiyun.controller;

import cn.jiyun.dto.*;
import cn.jiyun.feign.ContestFeign;
import cn.jiyun.pojo.ConsumerContestTopic;
import cn.jiyun.utils.Result;
import cn.jiyun.vo.ContestVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

/**
 * @author 季乾帅
 * @create 2023/8/28 16:03
 */
@RestController
@RequestMapping("/contest")
public class ContestController {

    @Autowired
    private ContestFeign contestFeign;

    @RequestMapping("/findAll")
    public Result findAll(String classroomId, @RequestBody ContestDTO contestDTO) {
        return contestFeign.findAll(classroomId, contestDTO);
    }

    @RequestMapping("/findClassroom")
    public Result findClassroom() {
        return contestFeign.findClassroom();
    }

    @GetMapping("/findGame")
    public Result findGame(Integer classroomId) {
        return contestFeign.findGame(classroomId);
    }

    @GetMapping("/findTeam")
    public Result findTeam() {
        return contestFeign.findTeam();
    }

    @PostMapping("/saveContestya")
    public Result saveContestya(String userId,@RequestBody ContestVO contestVO) {
        return contestFeign.saveContestya(userId,contestVO);
    }

    @PostMapping("/findTest")
    public Result findTest(String consumerId, @RequestBody ConsumerContestTopicDTO dto) {
        return contestFeign.findTest(consumerId, dto);
    }

    @GetMapping("/findNum")
    public Result findNum(Integer consumerId) {
        return contestFeign.findNum(consumerId);
    }

    @GetMapping("/findTopic")
    public Result findTopic(Integer consumerId, Integer topicId) {
        return contestFeign.findTopic(consumerId, topicId);
    }

    @PostMapping("/findTrain")
    public Result findTrain(String classroomId, @RequestBody TrainDTO dto) {
        return contestFeign.findTrain(classroomId, dto);
    }

/*    @GetMapping("/findTrainCourse")
    public Result findTrainCourse(String uid) {
        return contestFeign.findTrainCourse(uid);
    }*/

    @GetMapping("/findById")
    public Result findById(String trainId) {
        return contestFeign.findById(trainId);
    }

    @GetMapping("/findOrCourse")
    public Result findOrCourse(String trainId, String uid) {
        return contestFeign.findOrCourse(trainId, uid);
    }

    @PostMapping("/findPaper")
    public Result findPaper(String classroomId, @RequestBody PaperDTO dto) {
        return contestFeign.findPaper(classroomId, dto);
    }

    @PostMapping("/toSave")
    public Result toSave(@RequestBody ConsumerContestTopic consumerContestTopic) {
        return contestFeign.toSave(consumerContestTopic);
    }

    @GetMapping("/findTihao")
    public Result findTihao(@SpringQueryMap ConsumerContestTopic consumerContestTopic) {
        return contestFeign.findTihao(consumerContestTopic);
    }

    @GetMapping("/findShiJuan")
    public Result findShiJuan(String contestId) {
        return contestFeign.findShiJuan(contestId);
    }

    @GetMapping("/QueryTimu")
    public Result queryTimu(String tiId) {
        return contestFeign.queryTimu(tiId);
    }

    @GetMapping("/findTests")
    public Result findTests(String id) {
        return contestFeign.findTests(id);
    }


    @GetMapping("/findZq")
    public Result findZq(String timuId) {
        return contestFeign.findZq(timuId);
    }

    @PostMapping("/findTeams")
    public Result findTeams(String userId, @RequestBody TeamDTO dto) {
        return contestFeign.findTeams(userId, dto);
    }

    @PostMapping("/findMyContest")
    public Result findMyContest(String userId, @RequestBody ContestDTO dto) {
        return contestFeign.findMyContest(userId, dto);
    }
    @PostMapping("/mySum")
    public Result mySum(@RequestBody ConsumerContestTopic consumerContestTopic) {
        return contestFeign.mySum(consumerContestTopic);
    }
    @GetMapping("/findMyUser")
    public Result findMyUser(String userId) {
        return contestFeign.findMyUser(userId);
    }

    @GetMapping("/findorlTest")
    public Result findorlTest(String userId) {
        return contestFeign.findorlTest(userId);
    }


}
